#ifndef PROGRAM_HPP
#define PROGRAM_HPP

/* Ensure we are using opengl's core profile only */
#define GL3_PROTOTYPES 1

// External Includes
//#include "windows.h"
#include "stdlib.h"
#include "stdio.h"
#include <sstream>
#include <fstream>
#include "time.h"
#include "time.h"
#include "glew.h"

// Internal Includes
#include "Game.hpp"
#include "GlobalDefines.hpp"
#include "State/App.hpp"
#include "Console/Console.hpp"
#include "utils/FPSTracker.hpp"

class Program
{
public:
  Program(std::string title);

  int Start();

  void Resize(int w, int h);

  // Input Handling

  void MouseClick(sf::Mouse::Button button, sf::MouseState state, int x, int y);

  void MouseMoved(int x, int y);

  void MouseDragged(int x, int y);

  void MouseWheel(int delta);

  void KeysDown(sf::Event::KeyEvent key);

  void KeysUp(sf::Event::KeyEvent key);

  void TextEntered(sf::Uint32 code);

private:
  Game *pWorld;   // Game object - a higher level abstraction

  bool initOk;    // flag to keep track if initialization went ok

  FPSTracker fpsTracker;

  bool showFPS;

  sf::Text fpsText;
    
  sf::Font fpsFont;

  // vars used for mouse differences, passed down
  int mouseMovedLastX;

  int mouseMovedLastY;

  int mouseDraggedLastX;

  int mouseDraggedLastY;

  int mouseSavedX;

  int mouseSavedY;

  bool mouseLeftButton;

  bool mouseRightButton;

  bool mouseWasJustWarped;

  std::string temp; //used for various monitors/tests

  sf::Clock timer;  // used for updating on a timer basis

  // Functions

  void Setup(); // Graphics context setup

  void Cleanup ();

  // Main loop functions

  void HandleInput();

  void Update();

  void Draw();
};

#endif
